package com.zrwl.poscloud.xo.utils;

import com.fasterxml.jackson.databind.JsonSerializer;

import java.io.IOException;
import java.text.DecimalFormat;

/**
 * @author 刘思童
 * 并没有作用
 * @create 2021-09-29 16:59
 **/
public class CustomDoubleSerialize extends JsonSerializer<Object> {
    private DecimalFormat df = new DecimalFormat("#0.00");

    @Override
    public void serialize(Object aDouble, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws IOException {
        if ((double) aDouble != 0) {
            jsonGenerator.writeString(df.format(aDouble));
        }
    }
}
